
/**
*función que enmascara la solicitud de un elemnto por el id
*idea original de prototype
*/
function $(idControl){
		return document.getElementById(idControl);
}

/**
*
*funcion que enmascara el usio tagname
*/
function $TN(tag,elemento){
	var salida;
	if(typeof elemento !='undefined')
		salida=elemento.getElementsByTagName(tag);
	else
		salida=document.getElementsByTagName(tag);
	return salida;
}

function validaNumerico(){
	var cedulaForm = document.getElementById('cedula');
	var cedula = cedulaForm.value;
	if(cedula == ''){
		alert("La cedula es obligatoria para la modificacion del usuario.");
		return false;
	}else{
		alert("HOLA");

		alert(" resultado: " + isSignedInteger(cedula));
		
		if( !isSignedInteger(cedula))  {
			 alert( "Solo debe ingresar numeros en el campo cedula." );

		}    else{
		 document.formEmpleado.submit;
	   }
	}
}

function isPositiveInteger (s)
{   
var secondArg = defaultEmptyOK;

    if (isPositiveInteger.arguments.length > 1)
        secondArg = isPositiveInteger.arguments[1];

    // The next line is a bit byzantine.  What it means is:
    // a) s must be a signed integer, AND
    // b) one of the following must be true:
    //    i)  s is empty and we are supposed to return true for
    //        empty strings
    //    ii) this is a positive, not negative, number

    return (isSignedInteger(s, secondArg)
         && ( (isEmpty(s) && secondArg)  || (parseInt (s) > 0) ) );
}

function isSignedInteger (s)

{   if (isEmpty(s)) 
       if (isSignedInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isSignedInteger.arguments[1] == true);

    else {
        var startPos = 0;
        var secondArg = defaultEmptyOK;

        if (isSignedInteger.arguments.length > 1)
            secondArg = isSignedInteger.arguments[1];

        // skip leading + or -
        if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
           startPos = 1;    
        return (isInteger(s.substring(startPos, s.length), secondArg))
    }
}

function isDigit (c)
{   return ((c >= "0") && (c <= "9"))
}


function isInteger (s)

{   var i;

    if (isEmpty(s)) 
       if (isInteger.arguments.length == 1) return defaultEmptyOK;
       else return (isInteger.arguments[1] == true);

    // Search through string's characters one by one
    // until we find a non-numeric character.
    // When we do, return false; if we don't, return true.

    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);

        if (!isDigit(c)){                                       
                                         return false;
                                } 
    }

    // All characters are numbers.
    return true;
}

function isEmpty(s)
{   return ((s == null) || (s.length == 0))
}

